home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
FROMUTS
/
UNIXLIB37B
/
src
/
unix
/
c
/
chmod
< prev
next >
Wrap
Text File
|
1991-06-14
|
588b
|
40 lines
static char sccs_id[] = "@(#) chmod.c 1.2 "__DATE__" HJR";
/* chmod.c (c) Copyright 1990 H.Rogers */
#include <errno.h>
#include "sys/types.h"
#include "sys/unix.h"
#include "sys/os.h"
int chmod(char *file,register int mode)
{
int r[6];
os_error *e;
file = __uname(file,0);
if (e = os_file(5,file,r))
{
__seterr(e);
return(-1);
}
if (!r[0])
{
errno = ENOENT;
return(-1);
}
r[5] = (r[5] & 0xFFFFFF00) | ((mode & 0400)>>8) | ((mode & 0200)>>6) |
((mode & 0004)<<2) | ((mode & 0002)<<4);
if (e = os_file(1,file,r))
{
__seterr(e);
return(-1);
}
return(0);
}